1303 stories
·
0 followers

How do I use Win32 structures from the Windows Runtime?

2 Shares

The Windows Runtime attempts to provide a language-independent interface for Windows APIs: The ABI is consistent across the Windows Runtime, and the APIs themselves are described via metadata, allowing each language to map the Windows Runtime concepts into concepts that are more natural for each target language. For example, the Windows Runtime DateTime maps to a corresponding date-time type for each target language, like std::chrono::time_point for C++ or Date for JavaScript. A cost of this goal is that the expressiveness of the Windows Runtime is constrained by the desire to make all the features available to all languages. For example, there are no raw pointers in the Windows Runtime.

Win32 structures defined in classic C/C++ header files are not part of the Windows Runtime. So in a literal sense, you can’t use them from the Windows Runtime.

But you can fake it.

You can declare a shadow structure in the Windows Runtime that has the same layout as the classic Win32 structure you want to use. For example, you could declare your own Win32Point structure:

struct Win32Point
{
    Int32 X;
    Int32 Y;
};

Note that the Windows Runtime has its own conventions for some things that in Win32 are represented by structures. For example, the PROPERTYKEY structure is represented conventionally in the Windows Runtime in its string form. You can use functions like PSPropertyKeyFromString and PSStringFromPropertyKey to convert between them.

The post How do I use Win32 structures from the Windows Runtime? appeared first on The Old New Thing.

Read the whole story
Share this story
Delete

At Least 80% Responsibility For Ill Health In Old Age Down to Individual, Study Says

1 Share
A new Oxford Longevity Project report argues that individuals bear at least 80% of the responsibility for ill health in old age. "The report (PDF), launched at the Smart Ageing Summit in Oxford last week, argues that individuals have far greater control over their longevity than is commonly understood," reports The Guardian. "The authors call on the government to take legislative action on alcohol comparable to restrictions on smoking." From the report: Living Longer, Better -- the Oxford Longevity Project's first Age-less report -- was co-authored by an interdisciplinary panel of UK-based experts in medicine, physiology, ageing and education policy. It was sponsored by Oxford Healthspan. The report's authors, Sir Christopher Ball, Sir Muir Gray, Dr Paul Ch'en, Leslie Kenny and Prof Denis Noble, present the figure of 80% as a conservative estimate. [...] The claim, however, has been described as simplistic and said to neglect wider arguments about whether people are genuinely in control of individual choices when it comes to issues including poverty, pollution and healthcare access. [...] Ball, however, pointed to research including the Landmark Twins Study, where researchers concluded at least 75% of human lifespan is determined by environmental and modifiable lifestyle factors. He also cited large-scale analysis led by Oxford Population Health using data from nearly 500,000 UK Biobank participants which found that environmental exposures and habits carry far greater weight in premature death and biological ageing than inherited genetics. The report's recommendations include avoiding processed foods, abstaining entirely from alcohol, prioritising sleep, not eating after 6.30pm, and cultivating what it calls "a not-meat mindset." On alcohol, it takes a position more forthright than current government guidance. "Alcohol is toxic, don't drink it," said Ball. "The report bravely says so -- whereas the government is afraid to tell the public the truth."

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

AI put "synthetic quotes" in his book. But this author wants to keep using it.

1 Share

Journalist and author Steven Rosenbaum has more reasons than most to distrust AI.

His new book, The Future of Truth: How AI Reshapes Reality, is all about "how Truth is being bent, blurred, and synthesized" thanks to the "pressure of fast-moving, profit-driven AI." Yet a New York Times investigation this week found what Rosenbaum now acknowledges are "a handful of improperly attributed or synthetic quotes" linked to his use of AI tools while researching the book.

These quotes include one that tech reporter Kara Swisher told the Times she "never said" and another that Northeastern University professor Lisa Feldman Barrett said "don’t appear in [my] book, and they are also wrong." Rosenbaum is now working with editors on what he says is a full "citation audit" that will correct future editions.

Speaking to Ars in the wake of the controversy, Rosenbaum says he "learned a lesson" and is "going to be much more suspicious" and "reticent to trust" AI outputs going forward.

But he also can't tear himself away from the tools. Rather amazingly, Rosenbaum is not interested in going back to the AI-free research process he used to write previous books.

"The idea of taking X years off [from AI] while it sorts itself out, and going back to, like, Microsoft Word … it's just not in my nature," he told Ars. "[AI] is magical. Because it connects, it knits together ideas and gives you pathways to think about things that you're not going to come up with on your own."

It's also magical in another way: Like J.R.R. Tolkien's One Ring, AI convinces many of those who use it that they can control its power properly. But can they?

Slipping through the cracks

Rosenbaum used AI tools during his writing process, he told me, "to surface ideas, locate articles, summarize themes, identify people or papers I might want to look into." He draws a hard line between this kind of research and the "actual reporting, narrative structure, interviews, arguments, and conclusions in the book," which he says are "entirely mine... There was never a time when AI was writing the book."

In addition to chapters based on transcribed interviews that Rosenbaum says he conducted himself, The Future of Truth also includes more research-based chapters in which Rosenbaum said, "We're pulling facts and then knitting them together into a narrative." Tools like OpenAI's ChatGPT and Anthropic's Claude were used heavily to gather information, he said, with any nuggets mined by those tools tagged with a "this came from AI" warning in his notes.

Those tagged AI-generated notes were then passed on to a fact-checker and two copy editors provided by the publisher, Rosenbaum said. Of the 285 outside citations in the book, six have been identified by the Times as problematic, including three so-called "synthetic quotes" that have no apparent source. (More examples could turn up as the book undergoes further review. And it's worth noting that most writers manage to include zero made-up quotes when they write a book.)

"I think we did that [double-checking] incredibly effectively, but not a hundred percent," Rosenbaum told Ars. "We're doing the work, we're doing the best we can. We look at it, it looks right. We double-check it, and then we made a mistake."

But the significant failure here highlights how the traditional fact-checking process might be ill-equipped to handle AI-assisted research. In the past, a fact-checker could be reasonably confident that any author quoting cited written works had simply copied down those quotes directly. These quotes would need to be checked, of course, but the fact that they're so easy to verify makes them less inherently suspicious. If AI tools are involved anywhere in the pipeline, though, that assumption goes out the window, and there needs to be an extra layer of skepticism that those quotes had been copied correctly or that they even exist at all.

The widespread adoption of AI tools among writers of all stripes also comes at a time when financially pressured newsrooms and publishers are increasingly cutting copy editors and fact-checkers from their workflows. We've seen how AI-generated errors like this can make it into a published book even with a fact-checking layer. The risk of using those tools only increases for the many books that never go through any fact-checking before publication.

Rosenbaum, for his part, agreed that "publishers are going to need new verification workflows designed specifically for AI-era research. That probably includes mandatory source tracing for quotations, better provenance tracking, clearer standards around AI-assisted research, and potentially (more irony here) AI tools that audit citations against primary materials."

"I didn’t set out to fabricate anything," Rosenbaum continued. "What happened is what increasingly happens to journalists, students, researchers, lawyers, and authors working with these systems every day: [There was] AI-generated information that looked authoritative, and some of it made its way too far downstream before being caught."

Cursing at the machine

Instances of prominent AI-generated errors are becoming distressingly common across a number of fields. Last year, the Chicago Sun-Times printed an advertorial summer reading list full of non-existent books dreamed up by AI. The New York Times recently had to issue a significant correction after published quotes attributed to Conservative leader Pierre Poilievre turned out to be "an A.I.-generated summary of his views." Publications including Wired and Business Insider pulled down multiple articles attributed to "Margaux Blanchard" that appeared to be AI-generated. Scholarly conferences have been beset by papers with hallucinated citations, and pre-print clearinghouse arXiv has recently implemented a zero-tolerance ban policy to try to stem the problem.

Ars itself is not immune to this problem. Earlier this year, we retracted an article after a former reporter used an AI tool designed to extract verbatim quotes from a source's blog post—but the tool instead generated fabricated versions of what the source actually wrote. (The latest version of our AI policy can be found here.)

The irony of an author incorporating AI-generated falsehoods into a book on AI's reality-skewing effects is not lost on Rosenbaum. "I appreciate the book getting some attention, but this would not have been my choice about how to get it," he said.

While that irony is "uncomfortable," he's quick to spin it as "also instructive. The fact that someone writing critically about AI and verification could still encounter these failures tells you how pervasive and persuasive these systems have become." Rosenbaum's own issue with AI "demonstrates the problem more vividly than any abstract argument could," he said.

Perhaps. But if we accept this take, every avoidably obvious mess in the world might be a disguised good because it really helps illuminate the huge mistake. And that can't be right; sometimes "negligence" is just that.

When asked directly how he could succumb to some of the AI-related problems his own book warns about, Rosenbaum described what sounds like a dysfunctional relationship with a charming charlatan.

Author Steven Rosenbaum. Credit: The Future of Truth

"As a writer, AI is often a delightful writing companion," Rosenbaum told me. "When I say 'writing companion,' I don't use that lightly. It's strangely creative and crafty and unusual in all these ways... and then it betrays you in ways that are just really quite horrible."

Throughout our conversation, Rosenbaum frequently cited examples in which obvious AI errors left him enraged and literally cursing at the machine. Those date back to 2022, when Rosenbaum said he started experimenting with AI tools for "little research projects." At the time, he found AI answers "spectacularly useful" about 8 out of 10 times, with the remainder being confabulations that were "just not true."

Despite these errors, he kept using the tools in his life and work. When we talked on Tuesday, Rosenbaum said he had recently asked an AI tool to extract his "no changes, verbatim" speaker's notes out of a slide deck so he could use them for an upcoming presentation. He was about to print those extracted notes when he realized that the LLM had actually rewritten his words despite his "very clear instructions for the robot."

"And I say to it, 'Did you rewrite the words?' And it says, 'Well, I just made the language a little stronger.' Well, pardon me, but like, fuck you!" he said.

Even in the face of these kinds of profanity-inducing errors, though, Rosenbaum still believes that AI tools are too efficient not to use.

"The deck was 100 pages," Rosenbaum said. "To cut and paste page by page, the text from each page would have been an hour's worth of work, of mindless cutting and pasting. ChatGPT did it in about four seconds."

To which the obvious retort might be: Yes, it was fast.

But it was also wrong.

Getting off the motorcycle

The efficiency gains might be worth it when the only stakes are personal presentation notes. But The Future of Truth shows how the balance between AI's reliability and apparent speed should be weighed very differently when it comes to research that ends up in a published book.

As we continued our conversation, I kept coming back to that accuracy/efficiency trade-off, which Rosenbaum seemed to recognize as a problem at some level. Even as he called AI's research help "magical" and "delightful," he described dealing with AI's confabulations and ignored directives as a "pernicious and exhausting" struggle.

"It leaves you... uncomfortable almost any time you're using it," he said of its tendency to ignore clear instructions.

"I've never fought with tech before this, honestly," he said at another point. "And I use it extensively."

Given the issues with his new book, I asked if the risk of introducing inaccuracies that you might not catch was really worth the perceived benefits.

"I don't do drugs, and I don't drink, but I presume that that's kind of the question an addict asks when they're having one drink too many and they know they are," Rosenbaum said. "I've never been in a place where I thought the tech that I was using was both intoxicating and dangerous. And I wrote the book specifically to raise that concern, so if I end up being the poster child of not being aware of the guardrails, so be it."

At one point, when discussing the relative risks and rewards of using AI, Rosenbaum noted that he rides a bicycle but wouldn't ride a motorcycle. "I know a motorcycle gets me places faster. I think it's dangerous and I might die. And that's why I don't own a motorcycle," he said.

Rosenbaum made it clear that using AI was the relatively safe "bicycle" option in this analogy. I responded that the supercharged efficiency and catastrophic risk inherent in using AI made it feel a bit more like the motorcycle. Rosenbaum said "that might be fair" and thanked me for "sharpening" his analogy.

I then asked the obvious question: Are you going to keep riding the motorcycle?

"Can I get back to you on that?" he said.

Read full article

Comments



Read the whole story
Share this story
Delete

Doctors outraged after RFK Jr. fires leaders of key preventive medicine panel

1 Share

Top medical groups are outraged and alarmed that anti-vaccine Health Secretary Robert F. Kennedy Jr. has fired two leaders of an influential panel that makes recommendations and sets insurance coverage for preventive care—such as mammograms, colonoscopies, statin use, and depression screening.

On Wednesday, news broke that Kennedy had fired the two vice chairs of the US Preventive Services Task Force (USPSTF), leaving the critical, nonpartisan panel half empty. Typically, the task force is made of 16 independent, volunteer preventive medicine experts who serve four-year, overlapping terms. But with the new firings, USPSTF has eight vacancies, including the chair and vice chair positions.

Kennedy has already undermined the USPSTF's work by failing to replace members whose terms ended at the turn of the year, preventing the task force from meeting over the past year, and blocking it from releasing finalized recommendations on self-collected samples for cervical cancer screening.

With the new firings, doctors fear that USPSTF will go the way of the Advisory Committee on Immunizations Practices (ACIP) and its vaccine recommendations for the Centers for Disease Control and Prevention—which is to say, that Kennedy will remove expert members, replace them with unqualified allies, and push through fringe or politicized recommendations. Such damage to the task force threatens to imperil access to lifesaving preventive services for millions of Americans. Under the Affordable Care Act, most health insurance plans must cover recommended preventive services that the USPSTF grades as "A" or "B," which reflect the evidence-based certainty of benefit.

Doctors respond

In a statement on Wednesday, American Medical Association President Bobby Mukkamala said the organization was "extremely concerned" by the firings.

"Today’s changes were foreshadowed by the earlier dismantling of the Advisory Committee on Immunization Practices (ACIP)," Mukkamala said. "We strongly urge HHS to restore the USPSTF’s long-standing, transparent process for selecting members, specifically clinicians with expertise in the fields of preventive medicine and primary care. We also implore HHS to commit to once again holding regular Task Force meetings to ensure its important work can continue without further delay. Our patients’ lives depend on it."

Likewise, Jan Carney, president of the American College of Physicians, said the group was "alarmed" while blasting the firing of the two doctors from the task force.

"Both physicians are highly qualified experts, and we take issue with the lack of transparency in any review that Secretary Kennedy has conducted of members of the task force," Carney said. "The firings come as the task force has not met over the course of the past year and has been prevented from doing their work to ensure that the American public has up-to-date guidance, based on the best-available evidence, about preventive health care services. The USPSTF guidance is critical to a healthy America, and we must not allow its membership or processes to be politicized."

Terminations

The two fired USPSTF members were John Wong, a professor at the Tufts University School of Medicine, and Esa Davis, a professor at the University of Maryland School of Medicine. According to reports, they received a letter from Kennedy, dated May 11, notifying them they were terminated "effective immediately."

As to why they were fired, the letter stated: "This action is administrative in nature and is unrelated to your performance or many years of dedicated service to the Task Force. It is not to be understood as a removal based on your leadership or contributions. To the contrary, the Department is taking this step to help protect the Task Force and preserve confidence in the continuity and durability of its work." It also said the terminations would "avoid uncertainty that could jeopardize the validity of future task force actions."

The doctors pushed back, with email exchanges and a meeting with a Trump administration official, but the justification for the terminations remained murky.

Kennedy has previously disparaged the USPSTF, calling it too "woke" and "lackadaisical and negligent for 20 years." He had also previously revealed plans to oust the panel.

Doctors are now calling for action to protect the task force. "The administration came after children’s immunizations, and now it’s coming after our mammograms and our other cancer screenings, and the medical community cannot let this happen," former USPSTF chair Michael Silverstein told The New York Times.

Read full article

Comments



Read the whole story
Share this story
Delete

Iran reportedly funneled billions through Binance to fund its military

1 Share
The Wall Street Journal claims Iran continued to use Binance to funnel money despite tough sanctions.

Read the whole story
Share this story
Delete

The classic TreeView control lets me sort by name or by lParam, but why not both?

2 Shares

The Win32 TreeView control in the common controls library provides two ways of sorting elements.

  • TVM_­SORT­CHILDREN: Sorts children alphabetically by name.
  • TVM_­SORT­CHILDREN­CB: Sorts children via custmm callback.

The custom callback is provided the lParam of the two tree items being compared. But what if you want to sort by a combination of both the text and the lParam? How do you get both?

There are two general designs for using UI controls that represent collections.

One model is for the UI control to be the data repository. Everything you need to know about the item resides in the UI control, somewhere in its name, its check state, its selection state, whatever. If you need to know something about an item, you ask the UI control for the information.

The second model is for the data repository to be some sort of object that itself does not have any UI. (This is known in the biz as a “data model”.) You then construct UI elements to be the representation of those objects.

Windows controls generally lean toward the data model approach because there is usually a lot of information about an item that is not present in its UI representation. The data model approach also allows for optimizations in which where very large collections of items create UI elements only for the items that are visible on screen. You can see this in the XAML ListView control as well as in the classic Win32 ListView control when placed into owner-data mode.

For the controls in the common controls library, the general pattern is to provide a place to store a pointer-sized value that is not shown in the UI, typically called “item data” or just lParam. Here is where you store a pointer to the data model object that the UI object represents.

Okay, so let’s look at the TreeView sort methods again.

The TVM_­SORT­CHILDREN­CB message takes a callback which is passed the lParams of two items to compare. The theory is that these lParams are pointers to larger data structures that describe the item, and you use those larger data structures to decide the ordering of the two items.

The TVM_­SORT­CHILDREN message doesn’t take a callback. It is a convenience method for the case where you are just sorting by name, so it uses the already-available name assigned to the item.

The case where you would need both is the case where the lParam is not enough to recover the name, either because it’s a pointer to a structure that doesn’t include a name, or because it’s not a pointer at all.

I can imagine running into this case if the only information you need to track for each TreeView item is its name and a pointer-sized piece of data. You put the name in the TreeView item text and the other data in the lParam. This plan works great until you need to sort the items, and your sort comparison function wants access to both pieces of data.

The solution is to switch to a data model pattern. Allocate a structure for each TreeView item and put the string and additional data in that structure. (Alternatively, you could just be sneaky and have the structure be the HTREEITEM and the additional data. Then you can recover the string by using the TVM_GET­ITEM message.)

Bonus chatter: In theory, the TVM_­SORT­CHILDREN­CB could have passed the HTREEITEMs to the callback. The callback could then use the HTREEITEM to obtain both the string and the lParam. I suspect this didn’t happen because most callback functions would just ask for the lParam from the HTREEITEM, TVM_­SORT­CHILDREN­CB is doing you a favor and saving you a bunch of work by giving you the thing you probably wanted in the first place.

The post The classic TreeView control lets me sort by name or by lParam, but why not both? appeared first on The Old New Thing.

Read the whole story
Share this story
Delete
Next Page of Stories